import request from "@/utils/request";

export default {
  login(username, passwork) {
    return request({
      method: "post",
      url: "/user/login",
      data: {
        username,
        passwork
      }
    });
  },
  getUserInfo(token) {
    return request({
      method: "get",
      url: `/user/info/${token}`
    });
  },
  logout(token) {
    return request({
      method: "post",
      url: "/user/logout",
      data: {
        token
      }
    });
  },
  updatePWD(userId, oldPassword, newPassword) {
    return request({
      method: "put",
      url: "/user/pwd",
      data: {
        userId,
        oldPassword,
        newPassword
      }
    });
  }
};
